package com.caigou.modules.forum.network.api

import com.caigou.comm.base.bean.CommentBean
import com.caigou.comm.base.bean.CommentItemBean
import com.caigou.comm.base.bean.HttpResult
import com.caigou.comm.base.bean.PrizeBallBean
import com.caigou.modules.forum.bean.*
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author #Suyghur.
 * Created on 2021/12/17
 */
interface HttpForumApiService {

    @GET("/api/gaxtczm/data/list")
    fun getForumList(
        @Query("page") page: Int,
        @Query("limit") limit: Int,
        @Query("type") type: Int,
        @Query("sort") sort: Int,
        @Query("currentUserId") currentUserId: String
    ): Flow<HttpResult<PostBean>>

    @GET("/api/gaxtczm/data/list")
    fun getMarketList(
        @Query("page") page: Int,
        @Query("limit") limit: Int,
        @Query("type") type: Int,
        @Query("superMaterialType") superMaterialType: Int,
        @Query("currentUserId") currentUserId: String
    ): Flow<HttpResult<PostBean>>

    @GET("/api/gaxtczm/data/history/list")
    fun getHistoryPostList(
        @Query("page") page: Int,
        @Query("limit") limit: Int,
        @Query("type") type: Int,
        @Query("userId") userId: String
    ): Flow<HttpResult<PostBean>>

    @GET("/api/gaxtczm/data/info")
    fun getPostDetail(@Query("dataId") dataId: Int, @Query("currentUserId") currentUserId: String): Flow<HttpResult<PostDetailBean>>

    @GET("/api/gaxtczm/data/reply/list")
    fun getCommentList(
        @Query("page") page: Int,
        @Query("limit") limit: Int,
        @Query("dataId") dataId: Int,
        @Query("sort") sort: Int,
        @Query("currentUserId") currentUserId: String
    ): Flow<HttpResult<CommentBean>>

    @GET("/api/gaxtczm/data/reply/details")
    fun getCommentDetail(
        @Query("dataId") dataId: Int,
        @Query("replyId") replyId: Int,
        @Query("userId") userId: String
    ): Flow<HttpResult<CommentItemBean>>

    @POST("/api/gaxtczm/data/like")
    fun setPostLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/gaxtczm/data/reply/like")
    fun setCommentLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/gaxtczm/data/reply")
    fun setReply(@Body body: RequestBody): Flow<HttpResult<String>>

    @POST("/api/gaxtczm/data/send")
    fun publishPost(@Body body: RequestBody): Flow<HttpResult<String>>

    @GET("/api/animal/number/list")
    fun getPrizeBallList(): Flow<HttpResult<MutableList<PrizeBallBean>>>

    @GET("/api/gaxtczm/data/fifa/list")
    fun getFifaTypeList(): Flow<HttpResult<MutableList<FifaItemBean>>>

    @GET("/api/menu/search")
    fun searchUser(
        @Query("limit") limit: Int,
        @Query("page") page: Int,
        @Query("searchType") searchType: Int,
        @Query("searchText") searchText: String,
        @Query("contentType") contentType: Int = 2
    ): Flow<HttpResult<SearchUserBean>>

    @GET("/api/menu/search")
    fun searchPost(
        @Query("limit") limit: Int,
        @Query("page") page: Int,
        @Query("searchType") searchType: Int,
        @Query("searchText") searchText: String,
        @Query("contentType") contentType: Int = 1
    ): Flow<HttpResult<PostBean>>

    @GET("/api/menu/ad/list")
    fun getAdList(): Flow<HttpResult<MutableList<AdItemBean>>>

    @GET("/api/menu/notice/list")
    fun getNoticeList(): Flow<HttpResult<MutableList<NoticeItemBean>>>

    @GET("/api/menu/notice/info")
    fun getNoticeDetail(@Query("id") id: Int, @Query("userId") userId: String): Flow<HttpResult<NoticeItemBean>>

    @GET("/api/menu/notice/reply/list")
    fun getNoticeCommentList(
        @Query("page") page: Int,
        @Query("limit") limit: Int,
        @Query("noticeId") dataId: Int,
        @Query("sort") sort: Int,
        @Query("currentUserId") currentUserId: String
    ): Flow<HttpResult<CommentBean>>

    @GET("/api/menu/notice/reply/details")
    fun getNoticeCommentDetail(
        @Query("noticeId") noticeId: Int,
        @Query("replyId") replyId: Int,
        @Query("userId") userId: String
    ): Flow<HttpResult<CommentItemBean>>

    @POST("/api/menu/notice/reply")
    fun setNoticeReply(@Body body: RequestBody): Flow<HttpResult<String>>

    @POST("/api/menu/notice/like")
    fun setNoticeLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/menu/notice/reply/like")
    fun setNoticeCommentLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @GET("/api/gaxtczm/data/red/packet/record")
    fun getPacketRecordList(@Query("page") page: Int, @Query("limit") limit: Int, @Query("redPacketId") redPacketId: Int): Flow<HttpResult<PacketRecordBean>>

    @GET("/api/gaxtczm/data/red/packet/record")
    fun getPacketRecordList2(@Query("redPacketId") redPacketId: Int): Flow<HttpResult<PacketRecordBean>>

    @GET("/api/gaxtczm/data/get/red/packet")
    fun getPacketDetail(@Query("redPacketId") redPacketId: Int, @Query("userId") userId: String): Flow<HttpResult<PacketDetailBean>>

    @GET("/api/menu/gift/list")
    fun getGiftRankList(@Query("userId") userId: String, @Query("currentUserId") currentUserId: String): Flow<HttpResult<MutableList<PostRankItemBean>>>
}